<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head lang="en">
		<base th:href="@{/}">
		<meta charset="utf-8" />
		<title>个人信息</title>
		<link rel="stylesheet" type="text/css" href="css/public.css"/>
		<link rel="stylesheet" type="text/css" href="css/mygrxx.css" />
	</head>
	<body>
	<!--xmlns:th="http://www.w3.org/1999/xhtml"-->
		<!------------------------------head------------------------------>
		<div class="head ding">
			<div class="wrapper clearfix">
				<div class="clearfix" id="top">
					<h1 class="fl"><a href="index.html"><img src="img/logo.png"/></a></h1>
					<div class="fr clearfix" id="top1">
						<p class="fl">
							<a href="#" id="login">登录</a>
							<a href="#" id="reg">注册</a>
						</p>
						<form action="#" method="get" class="fl">
							<input type="text" placeholder="搜索" />
							<input type="button" />
						</form>
						<div class="btn fl clearfix">
							<a href="mygxin.html"><img src="img/grzx.png"/></a>
							<a href="#" class="er1"><img src="img/ewm.png"/></a>
							<a href="cart.html"><img src="img/gwc.png"/></a>
							<p><a href="#"><img src="img/smewm.png"/></a></p>
						</div>
					</div>
				</div>
				<ul class="clearfix" id="bott">
					<li><a href="index.html">首页</a></li>
					<li>
						<a href="#">所有商品</a>
						<div class="sList">
							<div class="wrapper  clearfix">
								<a href="paint.html">
									<dl>
										<dt><img src="img/nav1.jpg"/></dt>
										<dd>浓情欧式</dd>
									</dl>
								</a>
								<a href="paint.html">
									<dl>
										<dt><img src="img/nav2.jpg"/></dt>
										<dd>浪漫美式</dd>
									</dl>
								</a>
								<a href="paint.html">
									<dl>
										<dt><img src="img/nav3.jpg"/></dt>
										<dd>雅致中式</dd>
									</dl>
								</a>
								<a href="paint.html">
									<dl>
										<dt><img src="img/nav6.jpg"/></dt>
										<dd>简约现代</dd>
									</dl>
								</a>
								<a href="paint.html">
									<dl>
										<dt><img src="img/nav7.jpg"/></dt>
										<dd>创意装饰</dd>
									</dl>
								</a>
							</div>
						</div>
					</li>
					<li>
						<a href="flowerDer.html">装饰摆件</a>
						<div class="sList2">
							<div class="clearfix">
								<a href="proList.html">干花花艺</a>
								<a href="vase_proList.html">花瓶花器</a>
							</div>
						</div>
					</li>
					<li>
						<a href="decoration.html">布艺软饰</a>
						<div class="sList2">
							<div class="clearfix">
								<a href="zbproList.html">桌布罩件</a>
								<a href="bzproList.html">抱枕靠垫</a>
							</div>
						</div>
					</li>
					<li><a href="paint.html">墙式壁挂</a></li>
					<li><a href="perfume.html">蜡艺香薰</a></li>
					<li><a href="idea.html">创意家居</a></li>
				</ul>
			</div>
		</div>
		<!------------------------------idea------------------------------>
		<div class="address mt">
			<div class="wrapper clearfix">
				<a href="index.html" class="fl">首页</a>
				<span>/</span>
				<a href="mygxin.html" class="on">个人信息</a>
			</div>
		</div>
		
		<!------------------------------Bott------------------------------>
	<div class="Bott">
		<div class="wrapper clearfix">
			<div class="zuo fl">
				<h3>
					<a href="">
						<img id="img1" style="width: 61%; height: auto; border-radius: 60px;"/>
					</a>
					<p class="clearfix"><span class="fl">[羊羊羊]</span><span class="fr">[退出登录]</span></p>
				</h3>
				<div>
					<h4>我的交易</h4>
					<ul>
						<li><a th:href="@{/trade/toShopCarPage}">我的购物车</a></li>
						<li><a>我的订单</a></li>
						<li><a th:href="@{/trade/toOrderCommentPage}">评价晒单</a></li>
					</ul>
					<h4>个人中心</h4>
					<ul>
						<li  class="on"><a th:href="@{/user/toMygxin}">我的中心</a></li>
						<li><a th:href="@{/address/toAddress}">地址管理</a></li>
					</ul>
					<h4>账户管理</h4>
					<ul>
						<li><a th:href="@{/user/toMygrxx}">个人信息</a></li>
						<li><a>修改密码</a></li>
					</ul>
				</div>
			</div>
				<div class="you fl">
					<h2>个人信息</h2>
					<div class="gxin">
						<div class="tx" style="margin-bottom: 150px;">
							<a><img style="width: 100%; height: auto; border-radius: 60px;"
									 th:src="'img/'+${user.avartar}"/>
								<p id="avatar">修改头像</p></a></div>
						<div class="xx">
							<h3 class="clearfix"><strong class="fl">基础资料</strong><a class="fr" id="edit1">编辑</a></h3>
							<div th:text="'姓名：'+${user.userName}"></div>
							<div th:text="'邮箱：'+${user.email}"></div>
							<div th:text="'电话：'+${user.tel}"></div>
						</div>
					</div>			
				</div>
			</div>
		</div>
		<!--遮罩-->
		<div class="mask"></div>
		<!--编辑弹框-->
		<div class="bj">
			<div class="clearfix"><a class="fr gb"><img src="img/icon4.png"/></a></div>
			<h3>编辑基础资料</h3>
			<form id="doUpdateInfo" role="form" th:object="${user}">
				<!--th:action="@{/order/doUpdateInfo}"-->
				<p><label>姓名：</label><input type="text" name="userName"  th:value="${user.userName}" /></p>
				<p><label>邮箱：</label><input type="text" name="email" th:value="${user.email}"/></p>
				<p><label>电话：</label><input style="width: 250px" type="text" name="tel" th:value="${user.tel}" /></p>
				<!--<p>
					<label>性别：</label>
					<span><input type="radio"  />男</span>
					<span><input type="radio"   />女</span>
				</p>-->
				<div class="bc">
					<input type="button" id="save" value="保存"  />
					<input type="button" value="取消" />
				</div>
			</form>
		</div>
		<!--高级设置修改-->
		<!--<div class="xg">
			<div class="clearfix"><a href="#" class="fr gb"><img src="img/icon4.png"/></a></div>
			<h3>切换账号地区</h3>
			<form action="#" method="get">
				<p><label>姓名：</label><input type="text"  value="六六六" /></p>
				<div class="bc">
					<input type="button" value="保存" />
					<input type="button" value="取消" />
				</div>
			</form>
		</div>-->
		<!--修改头像-->
		<div class="avatar">
			<div class="clearfix"><a class="fr gb"><img src="img/icon4.png"/></a></div>
			<h3>修改头像</h3>
			<form id="doUpdateAvartar" role="form" enctype="multipart/form-data">
				<!--order/doUpdateAvartar-->
				<h4>请上传图片</h4>
				<input type="file" name="file"  value="上传头像"/>
				<p>jpg或png，大小不超过50M</p>
				<input type="button" id="save1" value="提交" />
			</form>
		</div>
		
		<!--返回顶部-->
		<div class="gotop">
			<a href="cart.html">
			<dl>
				<dt><img src="img/gt1.png"/></dt>
				<dd>去购<br />物车</dd>
			</dl>
			</a>
			<a href="#" class="dh">
			<dl>
				<dt><img src="img/gt2.png"/></dt>
				<dd>联系<br />客服</dd>
			</dl>
			</a>
			<a href="mygxin.html">
			<dl>
				<dt><img src="img/gt3.png"/></dt>
				<dd>个人<br />中心</dd>
			</dl>
			</a>
			<a href="#" class="toptop" style="display: none">
			<dl>
				<dt><img src="img/gt4.png"/></dt>
				<dd>返回<br />顶部</dd>
			</dl>
			</a>
			<p>400-800-8200</p>
		</div>
		<!--footer-->
		<div class="footer">
			<div class="top">
				<div class="wrapper">
					<div class="clearfix">
						<a href="#2" class="fl"><img src="img/foot1.png"/></a>
						<span class="fl">7天无理由退货</span>
					</div>
					<div class="clearfix">
						<a href="#2" class="fl"><img src="img/foot2.png"/></a>
						<span class="fl">15天免费换货</span>
					</div>
					<div class="clearfix">
						<a href="#2" class="fl"><img src="img/foot3.png"/></a>
						<span class="fl">满599包邮</span>
					</div>
					<div class="clearfix">
						<a href="#2" class="fl"><img src="img/foot4.png"/></a>
						<span class="fl">手机特色服务</span>
					</div>
				</div>
			</div>
			<p class="dibu">最家家居&copy;2013-2017公司版权所有 京ICP备080100-44备0000111000号<br />
			违法和不良信息举报电话：400-800-8200，本网站所列数据，除特殊说明，所有数据均出自我司实验室测试</p>
		</div>
		<script src="js/jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/public.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/user.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/jquery-1.12.4.min.js"></script>
	    <script src="layui/layui.js"></script>
	    <link href="layui/css/layui.css">
		<script src="js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
	</body>
<script>
 $(document).ready(function () {
  $("#save").click(function () {
    var data=$("#doUpdateInfo").serialize();
     $.post("user/doUpdateInfo",data,function (data) {
         if(data.state==200){
         	alert(data.message);
         	location.reload();
		 }else{
         	alert(data.message);
		 }
	 })
  })
	 $("#save1").click(function () {
		 var data = new FormData($("#doUpdateAvartar")[0]);
		 $.ajax({
			 "url":"user/doUpdateAvartar",
			 "data":data,
			 "type":"POST",
			 "contentType":false,
			 "processData":false,
			 "dataType":"json",
			 success:function(data){
				 if(data.state==200){
				 	alert(data.message);
				 	alert(data.path);
					 var imagePath= data.message;
					 $("#img").attr("src",imagePath);
					 $.cookie("image",imagePath,{expires:7});
					 location.reload();
				 }else {
				 	layer.msg(data.message);
				 }
			 }
		 })
	 })
 })
 $(function () {
	 var imagePath= $.cookie("image");
	 //给img赋值
	 $("#img").attr("src",imagePath);
 })
</script>
</html>
